<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>#{msg.page_sample}</title>
    <f:view locale="#{config.localeApplication}"/>
    <h:outputStylesheet library="css" name="style.css"/>
    <f:event type="preRenderView" listener="#{config.checkUser}"/>


</h:head>
<h:body>

    <div class="wrapper">

        <div class="header">
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>

            <div id="menu" align="center">
                <ul>
                    <li><h:link value="#{msg.page_index}" outcome="/index"/></li>
                    <li><h:link value="#{msg.text_privateOffice}" outcome="/myAccount/myAccount"/></li>
                    <li><h:link value="#{msg.page_AutoBaraholka}" outcome="/advertisement/avtobaraholka"/></li>
                    <li><h:link value="#{msg.page_AutoBaraholka}2" outcome="/advertisement/avtobaraholka2"/></li>
                    <li><h:link value="#{msg.page_Weather}" outcome="/weather/weather"/></li>
                    <li><h:link value="Test" outcome="/test"/></li>

                </ul>
            </div>
        </div>
        <div class="middle">

            <div class="container">
                <div class="content">

                    <ui:insert name="body">

                        <!--Конент-->


                    </ui:insert>
                </div>

            </div>

            <div class="left-sidebar">
                <h:form>
                #{msg.text_searchAuto}
                <br/>
               #{msg.text_AddAdverBrand}:
                <h:selectOneMenu id="brand"
                                 validatorMessage="!"
                                 value="#{carSearch.brand_id}" onchange="submit()"
                                 valueChangeListener="#{carSearch.brandSet}"       >
                    <f:selectItem itemValue="0" itemLabel="---"/>
                    <f:selectItems value="#{car.brands}" var="brandItem"
                                   itemLabel="#{brandItem.nameEn}" itemValue="#{brandItem.id}" />
                    <f:validateLongRange minimum="1"/>
                </h:selectOneMenu>
                <h:message  for="brand"  style="color: red; font-size: 25px" />
                <br/>
                #{msg.text_AddAdverModel} :
                <h:selectOneMenu id="model"
                                 validatorMessage="!" value="#{carSearch.model_id}" onchange="submit()"
                                 valueChangeListener="#{carSearch.modelSet}"        >
                    <f:selectItem itemValue="0" itemLabel="---"/>
                    <f:selectItems value="#{car.models}" var="modelItem"
                                   itemLabel="#{modelItem.nameEn}" itemValue="#{modelItem.id}" />
                    <f:validateLongRange minimum="1"/>
                </h:selectOneMenu>
                <h:message  for="model"  style="color: red; font-size: 25px" />

                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <br/>

                <h:commandButton value="#{msg.text_Show}" action="#{carSearch.search}"/>
                </h:form>

            </div>

            <div class="right-sidebar">
                <h:form>
                <h:commandLink action="#{config.localeSetRu}">
                    <h:graphicImage value="/resources/image/languages/Russian%20Federation.png" style="border: 1px; margin-right: 1em"/>
                </h:commandLink>
                <h:commandLink action="#{config.localeSetEn}">
                    <h:graphicImage value="/resources/image/languages/United%20States%20of%20America%20(USA).png" style="border: 1px; margin-right: 1em"/>
                </h:commandLink>
                </h:form>
                <div align="center">
                    <br/>
                    <h:outputLabel style="color: red; font-size: 17px" value=" #{msg.text_infoUser}"/> <br/><br/>
                    <h:graphicImage name="#{userBean.avatar}" style="align-content: center; border: thin solid black" width="200"
                                    height="200" /><br/>
                </div>
                <h:outputLabel style="color: black" value="id : #{userBean.id}"/> <br/>
                <h:outputLabel style="color: black" value="#{msg.text_login} : #{userBean.login}"/> <br/>
                <h:outputLabel style="color: black" value="#{msg.text_accessLevel} : #{userBean.accessLevel}"/> <br/>
                <h:outputLabel style="color: black" value="#{msg.text_email} : #{userBean.email}"/> <br/>
                <h:form>
                    <h:commandButton value="#{msg.text_updateWather}" action="#{userBean.updateWeather}"/>
                </h:form>
                <h:panelGrid rendered="#{userBean.forecast!=null}">

                    <h:outputLabel style="color: black" value="#{msg.text_city} : #{userBean.forecast.city}"/> <br/>
                    #{msg.text_updateTime} #{userBean.forecast.fact.uptime}<br/>
                    #{msg.text_temperatureValue} :  #{userBean.forecast.fact.temperature.value}&#176;<br/>
                    #{userBean.forecast.fact.weatherType}<br/>
                    <br/>
                </h:panelGrid>

                <h:form>
                    <h:commandButton value="#{msg.text_privateOffice}" action="/myAccount/myAccount"/> <br/>
                    <h:commandButton value="#{msg.text_Out}" action="#{userBean.quit}"/> <br/>
                </h:form>


                <br/>

            </div>


        </div>

    </div>


    <div class="footer">
        <!--<h:form>-->
            <!--<h:dataTable value="#{admin.newUser}" var="newUser">-->
                <!--<h:column>-->
                    <!--<h:outputLink value="/user">-->
                        <!--<h:outputFormat id="infoUser" value="#{newUser.login} "/>-->
                        <!--<f:param name="id" value="#{newUser.id}" />-->
                    <!--</h:outputLink>-->
                <!--</h:column>-->
            <!--</h:dataTable>-->

        <!--</h:form>-->

        <div class="text" style="text-align: center"> Copyright Vanches</div>
    </div>
</h:body>
</html>

